ISCModelProperty Interface
The following table contains information on the ISCModelProperty interface:
Signature |
Description |
Valid Arguments |
---|---|---|
BSTR ClassName() |
Returns the class name of the property |
None |
SC_CLSID ClassId() |
Returns the class identifier of the property |
None |
Long Count() |
Contains the number of values in the property |
None |
BSTR FormatAsString() |
Formats the property value as a string |
None |
Example 13
The following example illustrates the iteration of properties using C++. The example uses a Model Object object from Example 9:
void IterateObjectProperties(ISCModelObjectPtr & scObjPtr) { ISCModelPropertyCollectionPtr propColPtr = scObjPtr->GetProperties(); // Iterate over the Collection IUnknownPtr _NewEnum = NULL; IEnumVARIANT* propCollection; _NewEnum = propColPtr->Get_NewEnum(); if (_NewEnum != NULL) { HRESULT hr = _NewEnum->QueryInterface(IID_IEnumVARIANT, (LPVOID*) &propCollection); if (!FAILED(hr)) { COleVariant xObject; while (S_OK == propCollection->Next(1,&xObject,NULL)) { ISCModelPropertyPtr scObjPropPtr = (V_DISPATCH (&xObject)); xObject.Clear(); if (scObjPropPtr.GetInterfacePtr()) { CString csPropName = (LPSTR) scObjPropPtr->GetClassName(); CString csPropVal= (LPSTR) scObjPropPtr->FormatAsString(); // … } } // property iteration } if (propCollection) propCollection->Release(); } }
The following example illustrates the iteration of properties using Visual Basic .NET. The example uses a Model Object object from Example 9:
Public Sub IterateObjectProperties(ByRef scObj As SCAPI.ModelObject)
Dim scObjProperties As SCAPI.ModelProperties Dim scObjProp As SCAPI.ModelProperty scObjProperties = scObj.Properties For Each scObjProp In scObjProperties Debug.WriteLine( scObjProp.ClassName ) Console.WriteLine( scObjProp.Name ) Next End Sub
Copyright © 2025 Quest Software, Inc. |